// import Home from '@/pages/Home'
// import Search from '@/pages/Search'
// import Login from '@/pages/Login'
// import Register from '@/pages/Register'
// const Home = () => import('@/pages/Home')
// const Search = () => import('@/pages/Search')
// const Login = () => import('@/pages/Login')
// const Register = () => import('@/pages/Register')
function lazy(comp) {
    return () => import("@/" + comp)
}
export default [
    {
        path: '/home',
        name: 'home',
        component: lazy('pages/Home'),
        children: [
            {
                path: '/home/child',
                component: lazy('components/Footer'),
                meta: {
                    name: "ss"
                }
            }
        ]
    },
    {
        path: '/search/:keyword?',
        name: 'search',
        component: lazy('pages/Search')
    },
    {
        path: '/login',
        name: 'login',
        component: lazy('pages/Login'),
        meta: {
            ishidden: true
        },
    },
    {
        path: '/register',
        name: 'register',
        component: lazy('pages/Register'),
        meta: {
            ishidden: true
        },
    },
    {
        path: '/detail/:skuid?',
        name: 'detail',
        component: lazy('pages/Detail'),
    },
    {
        path: '/addCartSuccess',
        name: 'addCartSuccess',
        component: lazy('pages/AddCartSuccess'),
        beforeEnter: (to, form, next) => {
            if (form.name === "detail") {
                next()
            } else {
                next('/search')
            }
        }
    },
    {
        path: '/shopCart',
        name: 'shopCart',
        component: lazy('pages/ShopCart'),
    },
    {
        path: '/trade',
        name: 'trade',
        component: lazy('pages/Trade'),
        beforeEnter: (to, form, next) => {
            if (form.name === "shopCart") {
                next()
            } else {
                next('/shopCart')
            }
        }
    },
    {
        path: '/pay',
        name: 'pay',
        component: lazy('pages/Pay'),
        beforeEnter: (to, form, next) => {
            if (form.name === "trade") {
                next()
            } else {
                next('/shopCart')
            }
        }
    },
    {
        path: '/paySuccess',
        name: 'paySuccess',
        component: lazy('pages/PaySuccess'),
        beforeEnter: (to, form, next) => {
            if (form.name === "pay") {
                next()
            } else {
                next('/shopCart')
            }
        }
    },
    {
        path: '/center',
        name: 'center',
        component: lazy('pages/Center'),
        redirect: '/center/myorder',
        children: [
            {
                path: '/center/myorder',
                name: 'myorder',
                component: lazy('pages/Center/components/Myorder'),
            },
            {
                path: '/center/otherOrder',
                name: 'otherOrder',
                component: lazy('pages/Center/components/OtherOrder'),
            },
        ]
    },

]